<!--- 
	  
  Copyright (c) 2006, Chris Scott, Matt Woodward, Adam Wayne Lehman, Dave Ross
  All rights reserved.
	
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  $Id: Comment.cfc 33 2006-10-18 01:42:37Z Chris.Scott.One $

--->

<cfcomponent displayname="Comment"
	output="false" hint="A bean which models the Comment form.">

<!--- This bean was generated by the Rooibos Generator with the following template:
Bean Name: Comment
Path to Bean: net.litepost.component.comment.Comment
Extends: 
Call super.init(): false
Create cfproperties: false
Bean Template:
	commentID Numeric 
	entryID String 
	comment String 
	fmtComment String 
	name String 
	email String 
	url String 
	siteName String 
	dateCreated Date 
	dateLastUpdated Date
Create getMemento method: false
Create setMemento method: false
Create setStepInstance method: false
Create validate method: false
Create validate interior: false
Date Format: MM/DD/YYYY
--->

	<!---
	PROPERTIES
	--->
	<cfset variables.instance = StructNew() />

	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" returntype="net.litepost.component.comment.Comment" output="false">
		<cfargument name="commentID" type="Numeric" required="false" default="0" />
		<cfargument name="entryID" type="String" required="false" default="" />
		<cfargument name="comment" type="String" required="false" default="" />
		<cfargument name="name" type="String" required="false" default="" />
		<cfargument name="email" type="String" required="false" default="" />
		<cfargument name="url" type="String" required="false" default="" />
		<cfargument name="dateCreated" type="Date" required="false" default="#Now()#" />

		<!--- run setters --->
		<cfset setCommentID(arguments.commentID) />
		<cfset setEntryID(arguments.entryID) />
		<cfset setComment(arguments.comment) />
		<cfset setName(arguments.name) />
		<cfset setEmail(arguments.email) />
		<cfset setUrl(arguments.url) />
		<cfset setDateCreated(arguments.dateCreated) />

		<cfreturn this />
 	</cffunction>
	
	<!--- validate the required fields --->
	<cffunction name="validate" access="public" returntype="boolean" output="false">
		<cfif len(getComment()) and len(getName()) and (len(getEmail()) or len(getUrl()))>
			<cfreturn true />
		<cfelse>
			<cfreturn false />
		</cfif>
	</cffunction>

	<!---
	ACCESSORS
	--->
	<cffunction name="setCommentID" access="public" returntype="void" output="false">
		<cfargument name="commentID" type="Numeric" required="true" />
		<cfset variables.instance.commentID = arguments.commentID />
	</cffunction>
	<cffunction name="getCommentID" access="public" returntype="Numeric" output="false">
		<cfreturn variables.instance.commentID />
	</cffunction>

	<cffunction name="setEntryID" access="public" returntype="void" output="false">
		<cfargument name="entryID" type="String" required="true" />
		<cfset variables.instance.entryID = arguments.entryID />
	</cffunction>
	<cffunction name="getEntryID" access="public" returntype="String" output="false">
		<cfreturn variables.instance.entryID />
	</cffunction>

	<cffunction name="setComment" access="public" returntype="void" output="false">
		<cfargument name="comment" type="String" required="true" />
		<cfset variables.instance.comment = arguments.comment />
	</cffunction>
	<cffunction name="getComment" access="public" returntype="String" output="false">
		<cfreturn variables.instance.comment />
	</cffunction>
	<cffunction name="getFmtComment" access="public" returntype="String" output="false" 
				hint="Returnes the Comment with returns replaced with BR tags">
		<cfreturn variables.instance.fmtComment />
	</cffunction>

	<cffunction name="setName" access="public" returntype="void" output="false">
		<cfargument name="name" type="String" required="true" />
		<cfset variables.instance.name = arguments.name />
	</cffunction>
	<cffunction name="getName" access="public" returntype="String" output="false">
		<cfreturn variables.instance.name />
	</cffunction>

	<cffunction name="setEmail" access="public" returntype="void" output="false">
		<cfargument name="email" type="String" required="true" />
		<cfset variables.instance.email = arguments.email />
	</cffunction>
	<cffunction name="getEmail" access="public" returntype="String" output="false">
		<cfreturn variables.instance.email />
	</cffunction>

	<cffunction name="setUrl" access="public" returntype="void" output="false">
		<cfargument name="url" type="String" required="true" />
		<cfset variables.instance.url = arguments.url />
	</cffunction>
	<cffunction name="getUrl" access="public" returntype="String" output="false">
		<cfreturn variables.instance.url />
	</cffunction>

	<cffunction name="setDateCreated" access="public" returntype="void" output="false">
		<cfargument name="dateCreated" type="Date" required="true" />
		<cfset variables.instance.dateCreated = arguments.dateCreated />
	</cffunction>
	<cffunction name="getDateCreated" access="public" returntype="Date" output="false">
		<cfreturn variables.instance.dateCreated />
	</cffunction>

</cfcomponent>